<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <!-- 查询条件 -->
        <el-form :model="searchForm" label-width="100px" class="search-form">
          <el-row>
            <el-col :span="8">
              <el-form-item label="人员编号">
                <person-rpc ref="personRpc" @personRpcCallBack="personRpcCallBack" />
              </el-form-item>
            </el-col>
            <el-col :span="8" class="text-right" style="float: left">
              <el-form-item>
                <el-button type="primary" @click="search">查询</el-button>
              </el-form-item>
            </el-col>

          </el-row>
        </el-form>
        <content-block label="人员信息">
          <el-descriptions title="">
            <el-descriptions-item label="用户名">kooriookami</el-descriptions-item>
            <el-descriptions-item label="手机号">18100000000</el-descriptions-item>
            <el-descriptions-item label="居住地">苏州市</el-descriptions-item>
            <el-descriptions-item label="备注">
              <el-tag size="small">学校</el-tag>
            </el-descriptions-item>
            <el-descriptions-item label="联系地址">江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item>
          </el-descriptions>
        </content-block>

        <content-block label="修改账户类型">
          <el-form ref="aae140Form" :model="aae140Form" label-width="180px" class="search-form">
            <el-row :gutter="20">
              <el-col :span="16">
                <el-form-item label="险种类型" :rules="[ { required: true, message: '险种类型'},]">
                  <el-select v-model="aae140Form.aae140" placeholder="请选择"  style="width:80%" @change="changeAae140" >
                    <el-option v-for="item in dict.aae140.filter(m  =>['110','120'].includes(m.value))" :key="item.id" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </content-block>


        <content-block label="业务年度信息维护">
          <div style="margin-bottom: 15px;margin-left: 15px">
            <el-button  type="primary" icon="el-icon-plus" size="mini"  @click="addywnd">新增</el-button>
            <el-button   type="danger" icon="el-icon-delete" size="mini"   :disabled="this.selectedRows.length == 0" @click="deleteywndbatch" >删除</el-button>
          </div>
          <el-table ref="table" v-loading="tableloding"  :data="tableData" size="small" border style="width: 100%;:height: 150"
                    :header-cell-style="{background:'#f5f7fa', color:'#777'}"   @selection-change="handleSelectionChange" >
            <el-table-column type="selection" width="50" />
            <el-table-column prop="aaz159" label="参保关系ID" align="center" header-align="center"/>
            <el-table-column prop="aae001" label="年度" align="center" header-align="center"/>
            <el-table-column prop="bae095" label="月数" align="center" header-align="center"/>

            <el-table-column
              fixed="right"
              label="操作"
              align="center"
              header-align="center"
              width="200">
              <template slot-scope="scope">
                <el-button  type="primary" icon="el-icon-edit" size="mini"  @click="editywnd(scope.row)"/>
                <el-button   type="danger" icon="el-icon-delete" size="mini" @click="deleteywnd(scope.row)" />
              </template>
            </el-table-column>

          </el-table>

        </content-block>
        <content-block label="缴费明细信息修改">

          <el-form ref="mxForm" :model="mxForm" label-width="210px" class="search-form">
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="对应费款所属期开始年月" >
                  <el-date-picker
                    v-model="mxForm.beginyear"
                    type="month"
                    placeholder="选择月">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="对应费款所属期结束年月" >
                  <el-date-picker
                    v-model="mxForm.endyear"
                    type="month"
                    placeholder="选择月">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="text-right" style="float: right">
                <el-form-item>
                  <el-button type="primary" @click="searchmx">查询</el-button>
                  <el-button @click="resetmx">重置</el-button>
                </el-form-item>
              </el-col>
            </el-row>

          </el-form>
          <div style="margin-bottom: 15px;margin-left: 15px">
            <el-button  type="primary" icon="el-icon-plus" size="mini"  @click="addmx">新增</el-button>
            <el-button   type="danger" icon="el-icon-delete" size="mini" :disabled="this.selectedRows2.length == 0" @click="deletemxbatch" >删除</el-button>
          </div>


            <el-table ref="table2" v-loading="table2loding" :data="tableData2" size="small" border style="width: 100%;" height="550"  :header-cell-style="{background:'#f5f7fa', color:'#777'}" @selection-change="handleSelectionChange2">
              <el-table-column type="selection" width="55" align="center" header-align="center"/>
<!--              <el-table-column prop="aaz648" label="养老保险人员实收明细ID" width="180"/>-->
<!--              <el-table-column prop="aaz223" label="人员征缴明细ID" width="180"/>-->
<!--              <el-table-column prop="aaz686" label="人员缴费ID" width="180"/>-->
              <el-table-column prop="aac001"  label="人员编号" width="180" fixed="left" align="center" header-align="center"/>
<!--              <el-table-column prop="aaz159" label="人员参保关系ID" width="180"/>-->
<!--              <el-table-column prop="aab001" label="单位编号" width="150" fixed="left"/>-->
<!--              <el-table-column prop="aae140" label="险种类型" width="120" fixed="left"/>-->
              <el-table-column prop="aae003" label="对应费款所属期" width="120" fixed="left" align="center" header-align="center"/>
              <el-table-column prop="aae002" label="费款所属期" width="120"  align="center" header-align="center"/>

              <el-table-column prop="aaa115" label="应缴类型" width="180"  align="center" header-align="center"/>
              <el-table-column prop="aae793" label="地方应缴类型" width="180" align="center" header-align="center"/>
<!--              <el-table-column prop="aae794" label="地方应缴类型名称" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aaa093" label="承担缴费主体类型" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aac066" label="参保身份" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aac313" label="地方参保身份码值" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aac314" label="地方参保身份名称" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae737" label="缴费资金来源" width="180" align="center" header-align="center"/>-->
              <el-table-column prop="aab019" label="单位类型" width="180" align="center" header-align="center"/>
<!--              <el-table-column prop="aab033" label="征缴方式" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae745" label="以个人身份参保人员缴费档次" width="180"/>-->
<!--              <el-table-column prop="aac028" label="农民工标识" width="180" align="center" header-align="center"/>-->
              <el-table-column prop="aac040" label="工资" width="180" align="center" header-align="center"/>
              <el-table-column prop="aab121" label="单位缴费基数" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae180" label="人员缴费基数" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae795" label="记账基数" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae871" label="缴费基数累计增加额" width="180" align="center" header-align="center"/>
<!--              <el-table-column prop="aae828" label="利息征收标志" width="180"/>-->
<!--              <el-table-column prop="aic380" label="利息截止年月" width="180"/>-->
<!--              <el-table-column prop="aae834" label="滞纳金征收标志"width="180" />-->
<!--              <el-table-column prop="aae845" label="滞纳金计算截止日期" width="180"/>-->
<!--              <el-table-column prop="aae844" label="补缴规则" width="180"/>-->
              <el-table-column prop="aab191" label="到账日期" width="180" align="center" header-align="center"/>
              <el-table-column  label="实缴金额" header-align="center">
              <el-table-column prop="aae080" label="单位" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae081" label="单位实缴划个人" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae082" label="个人" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae083" label="个人实缴划个人" width="180" align="center" header-align="center"/>
              </el-table-column>
<!--              <el-table-column  label="实缴利息" header-align="center">-->
<!--              <el-table-column prop="aae788" label="单位" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae789" label="单位实缴划入个人" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae790" label="个人" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae791" label="个人实缴划入个人" width="180" align="center" header-align="center"/>-->
<!--              </el-table-column>-->
<!--              <el-table-column  label="实缴金额利息其中本年利息" header-align="center">-->
<!--              <el-table-column prop="aae840" label="单位" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae841" label="单位实缴划个人" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae842" label="个人" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae843" label="个人实缴划个人" width="180" align="center" header-align="center"/>-->
<!--              </el-table-column>-->
<!--              <el-table-column  label="滞纳金" header-align="center">-->
<!--              <el-table-column prop="aae057" label="单位" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae888" label="个人" width="180" align="center" header-align="center"/>-->
<!--              </el-table-column>-->
<!--              <el-table-column prop="aae086" label="其他来源实缴金额" width="180" align="center" header-align="center"/>-->
<!--              <el-table-column prop="aae741" label="数据来源" width="180" align="center" header-align="center"/>-->
              <el-table-column prop="aae202" label="缴费月数" width="180" align="center" header-align="center"/>
              <el-table-column  label="缴费比例" header-align="center">
              <el-table-column prop="aaa042" label="单位" width="180" align="center" header-align="center"/>
              <el-table-column prop="aaa043" label="单位划入个人" width="180" align="center" header-align="center"/>
              <el-table-column prop="aaa041" label="个人" width="180" align="center" header-align="center"/>
              <el-table-column prop="aaa045" label="个人划入个人" width="180"  align="center" header-align="center"/>
              </el-table-column>
<!--              <el-table-column prop="aaz616" label="核定批次号" width="180"/>-->
<!--              <el-table-column prop="aaz615" label="核定流水号" width="180"/>-->
<!--              <el-table-column prop="aae061" label="补退流水号" width="180"/>-->
<!--              <el-table-column prop="aae108" label="参加单位结算标志" width="180"/>-->
<!--              <el-table-column prop="aab301" label="转出地行政区划代码"width="180" />-->
<!--              <el-table-column prop="aab299" label="转移参保地行政区划代码" width="180"/>-->
<!--              <el-table-column prop="aae729" label="转入业务起息年月" width="180"/>-->
<!--              <el-table-column prop="aae819" label="缴费备用字段1" width="180"/>-->
<!--              <el-table-column prop="aae820" label="缴费备用字段2"width="180" />-->
<!--              <el-table-column prop="aae796" label="双低系数（历史数据）" width="180"/>-->
<!--              <el-table-column prop="aae797" label="固化社平工资（历史数据）" width="180"/>-->
<!--              <el-table-column prop="aae798" label="基数比例（历史数据）" width="180"/>-->
<!--              <el-table-column prop="aae799" label="固化指数" width="180"/>-->
<!--              <el-table-column prop="aae800" label="账目类型" width="180"/>-->
<!--              <el-table-column prop="aaz625" label="征集流水号" width="180" />-->
<!--              <el-table-column prop="aae792" label="费用标志" width="180"/>-->
<!--              <el-table-column prop="aae150" label="实收年月" width="180"/>-->
<!--              <el-table-column prop="aae066" label="实收分配流水号" width="180"/>-->
<!--              <el-table-column prop="aae748" label="退费年月" width="180"/>-->
<!--              <el-table-column prop="aae822" label="退还账户滚存利息标志" width="180"/>-->
<!--              <el-table-column prop="aaz631" label="退费批次号" width="180"/>-->
<!--              <el-table-column prop="aaz650" label="退费流水号" width="180" />-->
              <el-table-column prop="aae013" label="备注" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae011" label="经办人" width="180" align="center" header-align="center"/>
              <el-table-column prop="aae036" label="经办时间" width="180" align="center" header-align="center"/>
              <el-table-column prop="aab359" label="参保地行政区划代码" width="180" align="center" header-align="center"/>

              <el-table-column
                fixed="right"
                label="操作"
                align="center"
                header-align="center"
                width="200">
                <template slot-scope="scope">
                  <el-button  type="primary" icon="el-icon-edit" size="mini"  @click="editmx(scope.row)"/>
                  <el-button   type="danger" icon="el-icon-delete" size="mini" @click="deletemx(scope.row)" />
                </template>
              </el-table-column>

            </el-table>

          <!--分页组件-->
          <el-pagination

            :page-size.sync="page.size"
            :total="page.total"
            :current-page.sync="page.page"
            style="margin-top: 8px;float: right"
            layout="total, prev, pager, next, sizes"
            @size-change="sizeChangeHandler"
            @current-change="pageChangeHandler">
          </el-pagination>

        </content-block>

        <el-dialog  :title="title_ac50a5" width="50%"   :visible.sync="dialog_ac50a5" >
          <el-form ref="ac50a5Form" :model="ac50a5Form"  border size="small" label-width="100px">
            <el-col :span="12">
              <el-form-item v-show="false" label="参保关系ID" prop="aaz159">
                <el-input v-model="ac50a5Form.aaz159"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item  label="年度" prop="aae001"  :rules="[ { required: true, message: '年度不能为空'},]">
                <el-date-picker
                  v-model="ac50a5Form.aae001"
                  type="year"
                  placeholder="选择年">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="年度月数" prop="bae095" :rules="[ { required: true, },]">
                <el-input-number v-model="ac50a5Form.bae095"  :min="1" :max="23" label="年度月数"></el-input-number>
              </el-form-item>
            </el-col>

          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="text" @click="cancel_ywnd">取消</el-button>
            <el-button type="primary" @click="ok_ywnd">确认</el-button>
          </div>
        </el-dialog>

        <el-dialog  title="新增实缴明细" width="75%"    :visible.sync="dialog_ac08add" >
          <content-block label="">
          <el-form ref="ac08addForm" :model="ac08addForm"  border size="small" label-width="100px">
            <el-col :span="8">
              <el-form-item  label="开始结束年月" prop="qh" label-width="180px" :rules="[ { required: true, message: '期号'},]">
                <el-date-picker
                  v-model="ac08addForm.qh"
                  type="monthrange"
                  format="yyyy-MM"
                  range-separator="至"
                  start-placeholder="开始月份"
                  end-placeholder="结束月份">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="应缴类型" prop="aaa115" :rules="[ { required: true,message: '应缴类型'} ,]" label-width="180px">
                <el-input v-model="ac08addForm.aaa115"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="缴费基数" prop="aae180" :rules="[ { required: true, message: '缴费基数'},]" label-width="180px">
                <el-input-number v-model="ac08addForm.aae180" size="medium"  :precision="2" :step="0.1" min="0"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="社平工资" prop="aae797" :rules="[ { required: true,message: '社平工资'} ,]" label-width="180px">
                <el-input-number v-model="ac08addForm.aae797" size="medium"  :precision="2" :step="0.1" min="0"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="单位缴费比例" prop="aaa042" :rules="[ { required: true,message: '单位缴费比例' },]" label-width="180px">
                <el-input-number v-model="ac08addForm.aaa042" size="medium"  :precision="2" :step="0.1" min="0" max="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="单位划入比例" prop="aaa043" :rules="[ { required: true, message: '单位划入比例'},]" label-width="180px">
                <el-input-number v-model="ac08addForm.aaa043" size="medium"  :precision="2" :step="0.1" min="0" max="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="个人划入比例" prop="aaa045" :rules="[ { required: true, message: '个人划入比例'},]" label-width="180px">
                <el-input-number v-model="ac08addForm.aaa045" size="medium"  :precision="2" :step="0.1" min="0" max="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="社平划入比例" prop="aae819" :rules="[ { required: true, message: '社平划入比例'},]" label-width="180px">
                <el-input-number v-model="ac08addForm.aae819" size="medium" :precision="2" :step="0.1" min="0" max="1"></el-input-number>
              </el-form-item>
            </el-col>

              <el-button type="primary" style="margin-right: 20px" @click="addDetail">批量添加</el-button>
              <el-button type="danger" style="margin-right: 20px" @click="DeleteDetail">批量删除</el-button>
              <el-button  style="margin-right: 20px"  @click="reloadDetail">重置条件</el-button>
          </el-form>
            </content-block>

          <content-block label="明细信息">
          <el-table ref="table3" v-loading="table3loding" :data="tableData3" size="small" border style="width: 100%;" height="350"  :header-cell-style="{background:'#f5f7fa', color:'#777'}" @selection-change="handleSelectionChange3">
            <el-table-column type="selection" width="55" />

            <el-table-column prop="aae003" label="对应费款所属期" width="100" fixed="left" align="center" header-align="center"/>
            <el-table-column prop="aaa115" label="应缴类型" width="120" align="center" header-align="center"/>
<!--            <el-table-column prop="aae793" label="地方应缴类型" width="180"/>-->
<!--            <el-table-column prop="aae794" label="地方应缴类型名称" width="180"/>-->
            <el-table-column prop="aae180" label="人员缴费基数" width="120" align="center" header-align="center"/>
<!--            <el-table-column prop="aab191" label="到账日期" width="180"/>-->
            <el-table-column  label="实缴金额" header-align="center"	align="center" >
            <el-table-column prop="aae080" label="单位" width="120" align="center" header-align="center"/>
            <el-table-column prop="aae081" label="单位划入" width="120" align="center" header-align="center"/>
<!--            <el-table-column prop="aae082" label="个人" width="180" />-->
            <el-table-column prop="aae086" label="社评" width="120" align="center" header-align="center"/>
            <el-table-column prop="aae083" label="个人划入" width="120" align="center" header-align="center" />
            </el-table-column>
<!--            <el-table-column  label="实缴利息" header-align="center"	 >-->
<!--            <el-table-column prop="aae788" label="单位" width="180"/>-->
<!--            <el-table-column prop="aae789" label="单位划入个人账户" width="180"/>-->
<!--            <el-table-column prop="aae790" label="个人" width="180"/>-->
<!--            <el-table-column prop="aae791" label="个人实缴划入个人账户" width="180"/>-->
<!--            </el-table-column>-->
<!--            <el-table-column  label="本年利息" header-align="center"	 >-->
<!--            <el-table-column prop="aae840" label="单位" width="180"/>-->
<!--            <el-table-column prop="aae841" label="单位划入个人账户" width="180"/>-->
<!--            <el-table-column prop="aae842" label="个人" width="180"/>-->
<!--            <el-table-column prop="aae843" label="个人实缴划入个人账户" width="180" />-->
<!--            </el-table-column>-->
<!--            <el-table-column  label="滞纳金" header-align="center"	 >-->
<!--            <el-table-column prop="aae057" label="单位" width="180"/>-->
<!--            <el-table-column prop="aae888" label="个人" width="180"/>-->
<!--            </el-table-column>-->
<!--            <el-table-column prop="aae086" label="其他来源实缴金额" width="180"/>-->
<!--            <el-table-column prop="aae741" label="数据来源" width="180"/>-->
<!--            <el-table-column prop="aae202" label="缴费月数" width="180"/>-->
            <el-table-column  label="缴费比例" header-align="center"	align="center" >
            <el-table-column prop="aaa042" label="单位" width="120" align="center" header-align="center"/>
            <el-table-column prop="aaa043" label="单位划入" width="120" align="center" header-align="center"/>
            <el-table-column prop="aae819" label="社评" width="120" align="center" header-align="center"/>
            <el-table-column prop="aaa045" label="个人划入" width="120" align="center" header-align="center" />
            </el-table-column>
<!--            <el-table-column prop="aae013" label="备注" width="180"/>-->
<!--            <el-table-column prop="aae011" label="经办人" width="180"/>-->
<!--            <el-table-column prop="aae036" label="经办时间" width="180"/>-->
<!--            <el-table-column prop="aab359" label="参保地行政区划代码" width="180"/>-->

<!--            <el-table-column-->
<!--              fixed="right"-->
<!--              label="操作"-->
<!--              align="center"-->
<!--              header-align="center"-->
<!--              width="150">-->
<!--              <template slot-scope="scope">-->
<!--                <el-button  type="primary" icon="el-icon-edit" size="mini"  @click="editmx(scope.row)"/>-->
<!--                <el-button   type="danger" icon="el-icon-delete" size="mini" @click="deletemx(scope.row)" />-->
<!--              </template>-->
<!--            </el-table-column>-->

          </el-table>
          </content-block>



          <div slot="footer" class="dialog-footer">
            <el-button type="info" @click="cancel_mx">取消</el-button>
            <el-button type="primary" @click="ok_mx">确认</el-button>
          </div>
        </el-dialog>

        <el-dialog  title="编辑实缴明细" width="70%"   :visible.sync="dialog_ac08edit" >
          <el-form ref="ac08editForm" :model="ac08editForm"  border size="small" label-width="100px">
            <el-col :span="12">
              <el-form-item v-show="false" label="养老保险人员实收明细ID" prop="aaz648">
                <el-input v-model="ac08editForm.aaz648"></el-input>
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item label="应缴类型" prop="aaa115" :rules="[ { required: true,message: '应缴类型'} ,]" label-width="180px">
                <el-input v-model="ac08editForm.aaa115"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="缴费基数" prop="aae180" :rules="[ { required: true, message: '缴费基数'},]" label-width="180px">
                <el-input-number v-model="ac08editForm.aae180" size="medium"  :precision="2" :step="0.1" min="0"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="单位缴费比例" prop="aaa042" :rules="[ { required: true,message: '单位缴费比例' },]" label-width="180px">
                <el-input-number v-model="ac08editForm.aaa042" size="medium"  :precision="2" :step="0.1" min="0" max="100"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="单位划入比例" prop="aaa043" :rules="[ { required: true, message: '单位划入比例'},]" label-width="180px">
                <el-input-number v-model="ac08editForm.aaa043" size="medium"  :precision="2" :step="0.1" min="0" max="100"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="个人划入比例" prop="aaa045" :rules="[ { required: true, message: '个人划入比例'},]" label-width="180px">
                <el-input-number v-model="ac08editForm.aaa045" size="medium"  :precision="2" :step="0.1" min="0" max="100"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="社评划入比例" prop="aae819" :rules="[ { required: true, message: '社评划入比例'},]" label-width="180px">
                <el-input-number v-model="ac08editForm.aae819" size="medium"  :precision="2" :step="0.1" min="0" max="100"></el-input-number>
              </el-form-item>
            </el-col>



          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="info" @click="cancel_mx">取消</el-button>
            <el-button type="primary" @click="ok_editmx">确认</el-button>
          </div>
        </el-dialog>
      </div>
    </div>
    <bottom-fixed>
      <div>
        <el-button type="primary" style="margin-right: 50px" @click="computerAccount">个人账户重汇</el-button>
        <el-button type="primary" style="margin-right: 50px" @click="printAccount">个人账户打印</el-button>
      </div>
    </bottom-fixed>
  </div>
</template>

<script>
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import PersonRpc from '@/views/ynsb_comm/comm/module/personRpc.vue'
import crudBasicAc01, { getAc01Ac02 } from '@/views/ynsb_comm/ac01/basicAc01'
import contentBlock from '@/components/labers/contentBlock'
import bottomFixed from '@/components/labers/bottomFixed'
import crudBasicAb02 from '@/views/ynsb_comm/ab02/basicAb02'
import apiac08, { computerAccount, printAccount } from '@/views/ynsb_comm/ac08/js/accountAc08'
import apiac50a5 from '@/views/ynsb_comm/ac08/js/accountAc50a5'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import crudMenu from '@/api/system/menu'


const defaultForm = { aaz153: null, aaa032: null, aaa030: null, aaa031: null, aae013: null, aae011: null, aae036: null, aae041: null, aae042: null, aab359: null }
export default {
  name: 'transferOut',
  components: { Treeselect, PersonRpc, pagination, crudOperation, rrOperation, udOperation,contentBlock,bottomFixed },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: 'api', url: 'api/accountAa08', idField: 'aaz153', sort: 'aaz153,desc', crudMethod: { ...apiac08 }})
  },
  // 数据字典
  dicts: ['aae140', ''],
  data() {
    return {
      cardPerson:[],

      aaz159:"",
      aac001:"",
      aae140:"",
      aab001:"",

      searchForm: {
        aac001: '', // 人员编号
        aac003: '' // 姓名
      },

      aae140Form: {
        aae140: '' // 养老保险转移制度方向
      },

      ac50a5Form: {
        aaz159: '',
        aae001: '',
        bae095: '',
      },
      mxForm: {
        beginyear: null,
        endyear: null,
      },

      ac08addForm: {
        qh: '',
        aae180: '',
        aaa115: '',
        aae797: '',
        aaa043: '',
        aaa042: '',
        aaa045: '',
        aae819: '',
      },

      ac08editForm: {
        aaz648:'',
        aaz223:'',
        aaz686:'',
        aac001:'',
        aaz159:'',
        aab001:'',
        aae140:'',
        aae002:'',
        aae003:'',
        aaa115:'',
        aae793:'',
        aae794:'',
        aaa093:'',
        aac066:'',
        aac313:'',
        aac314:'',
        aae737:'',
        aab019:'',
        aab033:'',
        aae745:'',
        aac028:'',
        aac040:'',
        aab121:'',
        aae180:'',
        aae795:'',
        aae871:'',
        aae828:'',
        aic380:'',
        aae834:'',
        aae845:'',
        aae844:'',
        aab191:'',
        aae080:'',
        aae081:'',
        aae082:'',
        aae083:'',
        aae788:'',
        aae789:'',
        aae790:'',
        aae791:'',
        aae840:'',
        aae841:'',
        aae842:'',
        aae843:'',
        aae057:'',
        aae888:'',
        aae086:'',
        aae741:'',
        aae202:'',
        aaa042:'',
        aaa043:'',
        aaa041:'',
        aaa045:'',
        aaz616:'',
        aaz615:'',
        aae061:'',
        aae108:'',
        aab301:'',
        aab299:'',
        aae729:'',
        aae819:'',
        aae820:'',
        aae796:'',
        aae797:'',
        aae798:'',
        aae799:'',
        aae800:'',
        aaz625:'',
        aae792:'',
        aae150:'',
        aae066:'',
        aae748:'',
        aae822:'',
        aaz631:'',
        aaz650:'',
        aae013:'',
        aae011:'',
        aae036:'',
        aab359:'',
      },


      tableData: [], // 基本养老信息表明细信息
      tableData2: [], // 账户明细信息
      tableData3: [], // 账户新增明细信息
      show_tab1:true,
      show_tab2:false,
      show_tab3:false,
      title_ac50a5:"",
      dialog_ac50a5:false,
      dialog_ac08add:false,
      dialog_ac08edit:false,

      selectedRows: [] , // 存储选中的行数据
      selectedRows2: [] , // 存储选中的行数据
      selectedRows3: [] , // 存储选中的行数据
      page:{
        //页码
        page:0,
        //每页数据条数
        size:10,
        //总数
        total:0
      },

      }
  },
  computed: {
    filteredOptions() {
      const filtered = this.dict.filter(item => {
        const excluded = [140, 180]; // 要过滤掉的值的数组
        return !excluded.includes(item.value);
      });
      return filtered;
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },

    personRpcCallBack(item) {
      this.form.aac001 = item.aac001
      this.searchForm = {
        aac001: item.aac001,
        aac003: item.aac003
      }
    },
    search() {
      // 假设查询的数据
      if (this.searchForm.aac001 !== '' && this.searchForm.aac001 !== null) {
        crudBasicAc01.getAc01Ac02({ ...this.searchForm }).then(res => {
          this.cardPerson=res

        })
      }
    },

    changeAae140(val){

      let filteredValues = this.cardPerson.filter(item => item.aae140 === val && item.aac008==='1')
      if(filteredValues.length==0){
        this.$message('未查询到该人员当前险种有效参保关系');
        return
      }
      this.aaz159=filteredValues.aaz159
      this.aac001=filteredValues.aac001
      this.aae140=filteredValues.aae140
      this.aab001=filteredValues.aab001
     this.getac50a5()

    },

    // 监听选中变化
    handleSelectionChange(val) {
      this.selectedRows = val
    },
    // 监听选中变化
    handleSelectionChange2(val) {
      this.selectedRows2 = val
    },
    // 监听选中变化
    handleSelectionChange3(val) {
      this.selectedRows3 = val
    },

    getac50a5(){
      this.tableloding=true
      apiac50a5.get({ aaz159: this.aaz159,}).then(res => {
        console.log(res)
        this.tableData = res
        this.tableloding=false
      })
    },

    //新增业务年度
    addywnd(){
      this.ac50a5Form.aaz159 =this.aaz159
      this.title_ac50a5="新增业务年度信息"
      this.dialog_ac50a5=true

    },
    //编辑业务年度
    editywnd(row) {

      this.title_ac50a5="编辑业务年度信息"
      this.dialog_ac50a5=true
      this.ac50a5Form = row;
      this.ac50a5Form.aae001=row.aae001.toString()
    },
    //取消保存
    cancel_ywnd(){

      this.dialog_ac50a5=false

    },
    //保存
    ok_ywnd(){
      if(this.title_ac50a5=='新增业务年度信息'){

        this.$refs.ac50a5Form.validate(valid => {
          if (valid) {

            console.log(this.ac50a5Form);
            const date = new Date(this.ac50a5Form.aae001);
            const year = date.getFullYear();  // 提取年份
            let data=this.ac50a5Form
            data.aae001=year

            apiac50a5.add(JSON.stringify(data)).then(res => {
              this.$notify({
                title: '保存成功',
                type: 'success'
              });
              this.getac50a5()
            })

          }
        });


      }else{
        this.$refs.ac50a5Form.validate(valid => {
          if (valid) {
            console.log(this.ac50a5Form);
            let date=this.ac50a5Form
            apiac50a5.edit(date).then(res => {
              this.$notify({
                title: '保存成功',
                type: 'success'
              });
              this.getac50a5()
            })

          }
        });


      }


      this.dialog_ac50a5=false
    },

    deleteywnd(row) {
      this.selectedRows = row
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.deleteac50a5()
      }).catch(() => {

      })
    },


    deleteywndbatch() {
      if(this.selectedRows.length==0){
        this.$message('请选择要删除的数据');
        return
      }

      this.$confirm('是否确认删除选中数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.deleteac50a5()
      }).catch(() => {

      })
    },

    deleteac50a5(){

      apiac50a5.del(JSON.stringify(this.selectedRows)).then(res => {
        this.$notify({
          title: '删除成功',
          type: 'success'
        });
        this.getac50a5()
      })
    },

    //查询缴费明细信息
    searchmx(){
      this.table2loding=true
      this.$refs.mxForm.validate(valid => {
        if (valid) {
          let data={}
        if(this.mxForm.beginyear!=null){
          const beginyear = this.formatDateToYearMonth(this.mxForm.beginyear)
          data.aae003start=beginyear
        }
          if(this.mxForm.endyear!=null) {
            const endyear = this.formatDateToYearMonth(this.mxForm.endyear)
            data.aae003end=endyear
          }
          data.aaz159=this.aaz159
          data.page=this.page.page-1
          data.size=this.page.size
          apiac08.get(JSON.stringify(data)).then(res => {
            this.tableData2=res.content
            this.page.total=res.totalElements
            this.table2loding=false
          })



        }
      });


    },
    resetmx(){
      this.$refs.mxForm.resetFields()

    },


    //新增缴费明细弹窗
    addmx(){
      this.dialog_ac08add=true
      this.tableData3=[]
      this.ac08addForm={}

    },
    //编辑缴费明细
    editmx(row) {
      debugger
      this.dialog_ac08edit=true
      this.ac08editForm = row;

    },

    //新增明细信息
    addDetail(){
      this.$refs.ac08addForm.validate(valid => {
          if (valid) {
            const retireFormdata ={}
          // 获取form的值
          const aae180 = this.ac08addForm.aae180
          const aaa043 = this.ac08addForm.aaa043
          const aaa042 = this.ac08addForm.aaa042
          const aaa045 = this.ac08addForm.aaa045
          const aae819 = this.ac08addForm.aae819
          const aae797 = this.ac08addForm.aae797
          const aae041 = this.formatDateToYearMonth(this.ac08addForm.qh[0])
          const aae042 = this.formatDateToYearMonth(this.ac08addForm.qh[1])
          const arr = []
          // 循环赋值
          for (let i = aae041; i <= aae042; i = this.addMonth(i, 1)) {
            retireFormdata.aae003 = i
            retireFormdata.aaa115 = this.ac08addForm.aaa115 // 应缴类型
            retireFormdata.aab191 = i + '01' // 到账日期
            retireFormdata.aae202 = '1' // 缴费月数（隐藏）
            retireFormdata.aae180 =aae180
            retireFormdata.aac001 =this.aac001
            retireFormdata.aae140 =this.aae140
            retireFormdata.aab001 =this.aab001
            retireFormdata.aaz159 =this.aaz159
            // 自动计算本金
         //   if (aae180 === 0 || aae180 === '0') { // 录入本金
              // 单位和个人比例
              // retireFormdata.aaa043 = aaa043
              // retireFormdata.aaa045 = aaa045
              // retireFormdata.aaa042 = aaa042
              // // 个人和单位本金
              // retireFormdata.aae080 = aaa042
              // retireFormdata.aae081 = aaa043
              // retireFormdata.aae083 = aaa045
              // retireFormdata.aae819 = aae819 / 100
              // // 社平
              // retireFormdata.aae086 = aae797 * aae819
            // } else {

              retireFormdata.aaa042 = aaa042
              retireFormdata.aaa043 = aaa043
              retireFormdata.aaa045 = aaa045
              retireFormdata.aae819 = aae819

              retireFormdata.aae080 = aae180 * aaa042
              retireFormdata.aae081 = aae180 * aaa043
              retireFormdata.aae083 = aae180 * aaa045
              retireFormdata.aae086 = aae797 * aae819

            // }
            arr.push({ ...retireFormdata, })
          }

          this.tableData3=arr

        }
      })

    },

    //删除明细信息
    DeleteDetail(){

      if(this.selectedRows3.length==0){
        this.$message('请选择要删除的数据');
        return
      }

      const arr = this.selectedRows3
      const newArr = this.tableData3.filter(item => !arr.some(item1 => item1.aae003 === item.aae003 && item1.key === item.key))
      this.tableData3 = newArr

    },

    //重置查询
    reloadDetail(){
     this.ac08addForm={}

    },

    //取消保存明细
    cancel_mx(){
      this.dialog_ac08add=false
      this.dialog_ac08edit=false

    },


    //保存明细信息新增
    ok_mx(){
      if(this.tableData3.length==0){
        this.$message('请先添加需要保存的数据');
        return
      }

            apiac08.add(JSON.stringify(this.tableData3)).then(res => {
              this.$notify({
                title: '保存成功',
                type: 'success'
              });
              this.searchmx()
            })

      this.dialog_ac08add=false
    },


    ok_editmx(){

      this.$refs.ac08editForm.validate(valid => {
        if (valid) {

          let date=this.ac08editForm
          apiac08.edit(date).then(res => {
            this.$notify({
              title: '保存成功',
              type: 'success'
            });
            this.searchmx()
          })

        }
      });
      this.dialog_ac08edit=false
    },


    deletemx(row) {
      this.selectedRows2 = row
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.deleteac08()
      }).catch(() => {

      })
    },


    deletemxbatch() {
      if(this.selectedRows2.length==0){
        this.$message('请选择要删除的数据');
        return
      }

      this.$confirm('是否确认删除选中数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.deleteac08()
      }).catch(() => {

      })
    },

    deleteac08(){

      apiac08.del(JSON.stringify(this.selectedRows2)).then(res => {
        this.$notify({
          title: '删除成功',
          type: 'success'
        });
        this.searchmx()
      })
    },








    // 当前页改变
    pageChangeHandler(e) {
      this.page.page = e
      this.searchmx()
    },
    // 每页条数改变
    sizeChangeHandler(e) {
      this.page.size = e
      this.page.page = 1
      this.searchmx()
    },
    // 预防删除第二页最后一条数据时，或者多选删除第二页的数据时，页码错误导致请求无数据
    dleChangePage(size) {
      if (this.tableData2.length === size && this.page.page !== 1) {
        this.page.page -= 1
      }
    },



    //个人账户重汇
    computerAccount(){
      apiac08.computerAccount({aaz159:"53000000000031086246",aac001:53332310398475,aae140:120}).then(res => {
        this.$notify({
          title: '重汇成功',
          type: 'success'
        });

      })

    },
    //个人账户打印
    printAccount(){
        window.open('http://localhost:8085/jmreport/view/1093757605187809280?token=123456&tenantId=3&aaz159=53000000000031086246', '_blank');
    },





    //时间格式化
    formatDateToYearMonth(dateStr) {
      const date = new Date(dateStr);
      const year = date.getFullYear();
      const month = ('0' + (date.getMonth() + 1)).slice(-2); // 确保两位数月份
      return `${year}${month}`;
    },

    //期号加减
    addMonth (yyyymm, mm) {
      if (yyyymm) {
        yyyymm = parseInt(yyyymm)
        let nmm = yyyymm % 100
        let nyy = parseInt(yyyymm / 100)
        nmm += mm
        nyy += Math.ceil(nmm / 12) - 1
        nmm = (nmm % 12) == 0 ? 12 : (nmm % 12)
        return nyy * 100 + nmm
      } else {
        return 0
      }
    },


  }
}
</script>

<style scoped>

</style>
